#include <stdio.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(void)
 {
 	int i,n;
 	scanf ("%d",n);
	 for (i=0;i<n;i++)
	 {
	 	int sum,j,m;
	 	sum = 0;
		scanf("%d",&m);
	 	if ((m>3)&&(m<50))
		 {
	 		for (j=2;j<=m;j++)
	 	     {
	 		    sum = sum + (j-1)*j*(j+1);
	 	     }
	 	   printf ("%d",sum); 
	 	}
	 	
	  } 
	return 0;
}
